package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.BuildingInformationClient;
import com.chinacoal.microservice.pojo.CcmsSmartleasingBuilding;
import com.chinacoal.microservice.service.BuildingInformationService;
import com.chinacoal.microservice.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-楼宇管理的控制类
 * @date 2020-11-06 17：56
 */

@RestController
public class BuildingInformationController implements BuildingInformationClient {

    @Autowired
    private BuildingInformationService buildingInformationService;

    /**
     * @author zhuliang
     * @Description: 根据楼宇名模糊查询(带分页)
     * @date 2020-11-09 11：18
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBuilding>> getLikeBuildingName(QueryCriteria queryCriteria, String token) {
        return buildingInformationService.getLikeBuildingName(queryCriteria, token);
    }

    /**
     * @author zhuliang
     * @Description: 查询所有的楼宇信息(带分页)
     * @date 2020-11-09 13：50
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBuilding>> getAllHouses(QueryCriteria queryCriteria, String token) {
        return buildingInformationService.getAllHouses(queryCriteria, token);
    }

    /**
     * @author zhuliang
     * @Description: 根据楼宇id查询对应的楼宇信息
     * @date 2020-11-09 13：57
     */
    @Override
    @UserLoginToken
    public Result<CcmsSmartleasingBuilding> getHousesById(String pkBuildingId, String token) {
        return buildingInformationService.getHousesById(pkBuildingId, token);
    }

    /**
     * @author zhuliang
     * @Description: 添加楼宇信息
     * @date 2020-11-09 14：20
     */
    @Override
    @UserLoginToken
    public Result addHouses(CcmsSmartleasingBuilding building, String token){
        return buildingInformationService.addHouses(building, token);
    }

    /**
     * @author zhuliang
     * @Description: 修改楼宇信息
     * @date 2020-11-09 14：38
     */
    @Override
    @UserLoginToken
    public Result updateHouses(CcmsSmartleasingBuilding building, String token){
        return buildingInformationService.updateHouses(building, token);
    }

    /**
     * @author zhuliang
     * @Description: 根据楼宇id删除对应的楼宇信息
     * @date 2020-11-09 14：52
     */
    @Override
    @UserLoginToken
    public Result deleteHouses(String token, String deleteId) {
        return buildingInformationService.deleteHouses(token, deleteId);
    }

    /**
     * @Description: 查询所有的楼宇信息
     * @author zhuliang
     * @date 2020/11/12 13:50
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBuilding>> getAll(String token) {
        return buildingInformationService.getAll(token);
    }

    /**
     * @Description: 根据楼宇id查询所有的省市区街道，房间
     * @author zhuliang
     * @date 2020/11/12 14:08
     */
    @Override
    @UserLoginToken
    public Result<CcmsSmartleasingBuilding> getAllByBuildingId(String pkBuildingIds, String token) {
        return buildingInformationService.getAllByBuildingId(pkBuildingIds, token);
    }

    /**
     * @Description: 根据区域编号id查询楼宇信息
     * @author zhuliang
     * @date 2020/12/2 18:30
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBuilding>> getAllByAreaNumberId(String areaNumberId, String token) {
        return buildingInformationService.getAllByAreaNumberId(areaNumberId, token);
    }
}
